hello(); // error here } function hello() // error here { // no error here as brackets can be put anywhere in the pear standard echo 'hello'; } function hello2() { if (TRUE) { // error here echo 'hello'; // no error here as its more than 4 spaces. } else { echo 'bye'; // error here } while (TRUE) { echo 'hello'; // error here } do { // error here echo 'hello'; // error here } while (TRUE); } function hello3() { switch ($hello) { case 'hello': break; } } } ?>
validate()) {
$safe = $form->getSubmitValues();
}
?>
open(); // error here
}
public function open()
{
// Some inline stuff that shouldn't error
if (TRUE) echo 'hello';
foreach ($tokens as $token) echo $token;
}
/**
* This is a comment 1.
* This is a comment 2.
* This is a comment 3.
* This is a comment 4.
*/
public function close()
{
// All ok.
if (TRUE) {
if (TRUE) {
} else if (FALSE) {
foreach ($tokens as $token) {
switch ($token) {
case '1':
case '2':
if (true) {
if (false) {
if (false) {
if (false) {
echo 'hello';
}
}
}
}
break;
case '5':
break;
}
do {
while (true) {
foreach ($tokens as $token) {
for ($i = 0; $i < $token; $i++) {
echo 'hello';
}
}
}
} while (true);
}
}
}
}
/*
This is another c style comment 1.
This is another c style comment 2.
This is another c style comment 3.
This is another c style comment 4.
This is another c style comment 5.
*/
/*
*
*
*
*/
/**
*/
/*
This comment has a newline in it.
*/
public function read()
{
echo 'hello';
// no errors below.
$array = array(
'this',
'that' => array(
'hello',
'hello again' => array(
'hello',
),
),
);
}
}
abstract class Test3
{
public function parse()
{
foreach ($t as $ndx => $token) {
if (is_array($token)) {
echo 'here';
} else {
$ts[] = array("token" => $token, "value" => '');
$last = count($ts) - 1;
switch ($token) {
case '(':
if ($last >= 3 &&
$ts[0]['token'] != T_CLASS &&
$ts[$last - 2]['token'] == T_OBJECT_OPERATOR &&
$ts[$last - 3]['token'] == T_VARIABLE ) {
if (true) {
echo 'hello';
}
}
array_push($braces, $token);
break;
}
}
}
}
}
function test()
{
$o = <<